CMAKE_MINIMUM_REQUIRED(VERSION 3.10) 
PROJECT(sophon) #项目名称

if(WIN32)
add_definitions(-D_WIN32)
add_definitions(-DLIBMPEG_EXPORTS)
add_definitions(-DWIN64)

add_definitions(-DNO_OPENSSL)
add_definitions(-DNDEBUG)
add_definitions(-DFFMPEG6)
else()
add_definitions(-DOS_LINUX)
add_definitions(-DNO_OPENSSL)
add_definitions(-DNDEBUG)
add_definitions(-DFFMPEG6)
endif()
# 允许gdb调试 
set(CMAKE_BUILD_TYPE "Debug") 
set(CMAKE_CXX_FLAGS_DEBUG "$ENV{CXXFLAGS} -O0 -Wall -g -ggdb") 
set(CMAKE_CXX_FLAGS_RELEASE "$ENV{CXXFLAGS} -O3 -Wall") 
set(CMAKE_SHARED_LINKER_FLAGS "-Wl,-Bsymbolic")

# 添加现代C++标准支持及其他选项 
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14 -g -fPIC") 
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC")



 # 添加libsophon的头文件目录
#set(LIBSOPHON_INCLUDE_DIRS  "/home/server/libsophon/libsophon_soc_0.5.1_aarch64/opt/sophon/libsophon-0.5.1/include")
#set(LIBSOPHON_LIB_DIRS  "/home/server/libsophon/libsophon_soc_0.5.1_aarch64/opt/sophon/libsophon-0.5.1/lib")

# 添加SAIL的头文件及动态库目录
#set(SAIL_INCLUDE_DIRS  "/home/server/libsophon/sophon-sail/build_soc/sophon-sail/include")
#set(SAIL_LIB_DIRS  "/home/server/libsophon/sophon-sail/build_soc/sophon-sail/lib")

# 添加sophon-opencv的头文件目录
#set(OpenCV_INCLUDE_DIRS  "/home/server/libsophon/sophon-mw-soc_0.10.0_aarch64/opt/sophon/sophon-opencv_0.10.0/include")
#set(OpenCV_LIB_DIRS  "/home/server/libsophon/sophon-mw-soc_0.10.0_aarch64/opt/sophon/sophon-opencv_0.10.0/lib")

# 添加sophon-ffmpeg的头文件及动态库目录
#set(FFMPEG_INCLUDE_DIRS  "/home/server/libsophon/sophon-mw-soc_0.10.0_aarch64/opt/sophon/sophon-ffmpeg_0.10.0/include")
#set(FFMPEG_LIB_DIRS  "/home/server/libsophon/sophon-mw-soc_0.10.0_aarch64/opt/sophon/sophon-ffmpeg_0.10.0/lib")


set(SOC_INCLUDE_DIRS  "/home/server/libsophon/sophon-ffmpeg/soc-sdk/include")
set(SOC_LIB_DIRS  "/home/server/libsophon/sophon-ffmpeg/soc-sdk/lib")



include_directories(
${SOC_INCLUDE_DIRS} 
${SOC_INCLUDE_DIRS}/sail
)


link_directories(
${SOC_LIB_DIRS} 
)

# 设置源码路径
file(GLOB SOURCE_FILES
    "${CMAKE_CURRENT_SOURCE_DIR}/*.cpp"
)


add_executable(${PROJECT_NAME} ${SOURCE_FILES})
target_link_libraries(${PROJECT_NAME} 
sail)
